﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class Log : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            txtNum.Focus();
        }
    }
    
    
    
    protected void btnLogin_Click(object sender, ImageClickEventArgs e)
    {
        DataSet ds = BLLFactory.CreateYhBLL().Select(txtNum.Text.ToString());
        if (ds != null)
        {
            Session["用户信息.单位"] = ds.Tables[0].Rows[0]["danwei"].ToString();
            Session["用户信息.部门"] = ds.Tables[0].Rows[0]["bumen"].ToString();
            Session["用户信息.岗位"] = ds.Tables[0].Rows[0]["gang"].ToString();
            Session["用户信息.姓名"] = ds.Tables[0].Rows[0]["xm"].ToString();
            Session["用户信息.密码"] = ds.Tables[0].Rows[0]["pass"].ToString();
            if (Session["用户信息.岗位"].ToString() == "库管")
                Session["用户信息.班组"] = ds.Tables[0].Rows[0]["banzu"].ToString();
            Response.Redirect("Default.aspx");
        }
        else
        {
            Response.Write("<script>window.alert('" + "用户不存在！" + "');</script>");
        }
    }
}
